﻿using System;
using System.Collections.Generic;

namespace Fish.Pattern.Observer
{
	/// <summary>
	/// 공급자 정의.
	/// </summary>
	/// <typeparam name="T"></typeparam>
	public interface IObservable<T>
	{
		IDisposable Subscribe(IObserver<T> observer);
	}

	/// <summary>
	/// 관찰자 정의.
	/// </summary>
	/// <typeparam name="T"></typeparam>
	public interface IObserver<T>
	{
		void OnCompleted();
		void OnError(Exception error);
		void OnNext(T value);

		void Subscribe(IObservable<T> provider);
		void Unsubscribe();
	}
}
